<script setup>
const { data } = defineProps({
  data: { type: Object, default: () => ({}) },
  type: { type: String, default: 'paper' }, // 预览类型 paper 学术 ｜ periodical 期刊
});
const emit = defineEmits(['close', 'formatSet']);
// 关闭弹窗
function closeDialog() {
  emit('close');
}
// 格式生成
function formatSet() {
  emit('close');
  emit('formatSet', data);
}
</script>

<template>
  <el-dialog
    :model-value="true"
    :title="`${data.qkLwName}预览`"
    @close="closeDialog"
    class="format-preview-dialog"
  >
    <div class="content">
      <div class="left-content">
        <img :src="data.qkLwImage" alt="" />
      </div>
      <div class="right-content">
        <div class="school-name">{{ data.qkLwName }}</div>
        <template v-if="type === 'paper'">
          <div class="degree subtitle">学位级别：{{ data.qkLwDegree }}</div>
          <div class="dimension subtitle">适用范围：{{ data.qkLwDimension }}</div>
        </template>
        <div class="format-set" @click="formatSet">格式生成</div>
      </div>
    </div>
  </el-dialog>
</template>

<style scoped lang="less">
@import './formatPreview.less';
</style>
